package lc;


import org.junit.Test;

public class Ex153 {
    class Solution {
        public int findMin(int[] nums) {
            int lo = 0, hi = nums.length - 1;
            //互不相同，保证了lo和hi的大小关系决定了排布规律
            if (nums[hi] > nums[lo]) return nums[lo];
            //必为旋转数组
            while (lo < hi) {
                int mid = (hi - lo) /2 + lo;
               if (nums[mid] > nums[0]) {
                   lo = mid + 1;
               } else if (nums[mid] < nums[0]) {
                   hi = mid;
               } else {
                   lo++;
               }
            }
        
            return nums[lo];
        }
    }


    @Test
    public void test() {
        // Solution s = new Solution();
        for (int i = 0; i < 10000; i++) {
            
        } 
        // int[] a = new int[1];
        // Queue<Integer> queue = new PriorityQueue<>();
    }
}
